interface Info {

}
//联系方式
class Contact implements Info {
    private String address;//地址
    private String telphone;//电话
    private String zipcode;//邮政编码

    public Contact(String address, String telphone, String zipcode) {
        this.address = address;
        this.telphone = telphone;
        this.zipcode = zipcode;
    }

    @Override
    public String toString() {
        return "地址：" + address +
                ", 电话：" + telphone +
                ", 邮政编码" + zipcode;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getTelphone() {
        return telphone;
    }

    public void setTelphone(String telphone) {
        this.telphone = telphone;
    }

    public String getZipcode() {
        return zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }
}
//个人基本信息
class Introduction implements Info {
    private String name;
    private String sex;
    private int age;

    public Introduction(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }

    @Override
    public String toString() {
        return "姓名：" + name  +
                ", 性别：" + sex  +
                ", 年龄：" + age ;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

class Person<T extends Info> {//指定了上界 必须是Info的接口
    private T info;

    public Person(T info) {
        this.info = info;
    }

    public T getInfo() {
        return info;
    }

    public void setInfo(T info) {
        this.info = info;
    }

    @Override
    public String toString() {
        return this.info.toString();
    }
}
public class Test_3 {
    public static void main(String[] args) {
        Contact c = new Contact("福建省","110","10086");
        Person<Contact> person1 = new Person<>(c);
        System.out.println(person1.toString());

        Introduction in = new Introduction("小猪","man",20);
        Person<Introduction> person2 = new Person<>(in);
        System.out.println(person2.toString());
    }
}
